package logic

import (
	"context"
	"jd-mall/jd-srv/jd"

	"jd-mall/api/internal/svc"
	"jd-mall/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShopDelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewShopDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShopDelLogic {
	return &ShopDelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ShopDelLogic) ShopDel(req *types.ShopDelrequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	list, err := l.svcCtx.Jd.ShowDel(l.ctx, &jd.ShowDelRequest{
		Id: req.Id,
	})
	if err != nil {
		return &types.Response{
			Data: nil,
			Msg:  err.Error(),
			Code: 500,
		}, nil
	}
	return &types.Response{
		Data: list,
		Msg:  "商品删除成功",
		Code: 200,
	}, nil
}
